public class TObject {
	public static final byte NODE = 1;
	
	private static long autoID = 0;
	private long ID;
	private byte objectType;
	protected TSimulator simulator;
	
	public static void resetID() {
		autoID = 0;
	}

	public TObject(byte objType) { 
		ID = autoID;
		autoID++;
		objectType = objType;
	}
	
	public long getID() { 
		return ID; 
	}
	
	public byte getObjectType() { 
		return objectType; 
	}
		
	public long getSimTime() { 
		return simulator.getSimTime(); 
	}
	
	public TSimulator getSimulator() { 
		return simulator; 
	}
	
	//-----------------------------Jobs Handling--------------------------------
	public void invokeCallback(byte taskName) { 
		switch (objectType) {
			case TObject.NODE:
				((TNode)this).invokeCallback(taskName);
				break;
			
			default: break;
		}
	}
	
	//-----------------------Task handling for Users------------------
	public void addTask(byte taskName) {
		TJob job = new TJob(TJob.TASK, taskName, null, this, null);
		simulator.addJob(job);
	}
	
	public void addTaskInTime(byte taskName, long time) {
		TJob job = new TJob(TJob.TASK, taskName, null, this, null);
		simulator.addJobInTime(job, time);
	}
	
	public void addTaskAtTime(byte taskName, String time) {
		TJob job = new TJob(TJob.TASK, taskName, null, this, null);
		simulator.addJobAtTime(job, time);
	}
}
